package com.vteApp;

import com.vteApp.bl.Risk;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.TableRow;
import android.widget.TextView;

public class RiskRow extends TableRow {

	private Risk risk;
	private TextView tv;
	private RiskToggleButton button;

	public RiskRow(Context context, Risk risk) {
		super(context);
		init(context, risk);

	}

	public RiskRow(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}

	private void init(Context context, Risk risk) {
		tv = new TextView(context);
		this.risk = risk;
		tv.setText(risk.getTitle());
		addView(tv);
		button = new RiskToggleButton(context);
		button.setTextOff(getResources().getString(R.string.no));
		button.setTextOn(getResources().getString(R.string.yes));
		button.setChecked(risk.getValue());
		addView(button);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		// TODO Auto-generated method stub
		super.onDraw(canvas);
	}

	public Risk getRisk() {
		return risk;
	}

	public void setRisk(Risk risk) {
		this.risk = risk;

	}

	public RiskToggleButton getButton() {
		return button;
	}

	public void setButton(RiskToggleButton button) {
		this.button = button;
	}

}
